package domainObjects;

import infrastructure.IDossier;
import infrastructure.IInfraction;

import java.util.ArrayList;
import java.util.List;

//create by martin souliere
public class Dossier implements IDossier{

	protected int id;
	protected String nom;
	protected String noPermis;
	protected String noPlaque;
	protected String prenom;
	protected List<IInfraction> infractions;
	
	public Dossier(int id,String nom, String prenom,String noPermis, String noPlaque) {
		this.id = id;
		this.nom = nom;
		this.noPermis = noPermis;
		this.noPlaque = noPlaque;
		this.prenom = prenom;
		this.infractions = new ArrayList<IInfraction>();
	}
	
	public Dossier(){}
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}

	public String getNom() {
		return nom;
	}
	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getNoPermis() {
		return noPermis;
	}
	public void setNoPermis(String noPermis) {
		this.noPermis = noPermis;
	}
	public String getNoPlaque() {
		return noPlaque;
	}
	public void setNoPlaque(String noPlaque) {
		this.noPlaque = noPlaque;
	}
	public String getPrenom() {
		return prenom;
	}
	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}
	
	public int niveau() {
		int max = 0;
		for (IInfraction infraction : infractions) {
			if(infraction.getNiveau() > max)
				max = infraction.getNiveau();
		}
		return max;
	}

	public List<IInfraction> getInfractions() {		
		return infractions;
	}
	
	public void setInfractions(List<IInfraction> infractions) {		
		this.infractions = infractions;
	}
	
	public void ajouterInfractionAListe(IInfraction infraction) {
		this.infractions.add(infraction);
	}

	public String _toString() {		
		return noPermis + " " + prenom + " " + nom + " " + noPlaque;
	}
	
	@Override
	public String toString() {
		return _toString();
	}
}
